using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace Lottery
{
	/// <summary>
	/// Summary description for Form1.
	/// </summary>
	public class frmMain : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ListView lvwMain;
		private System.Windows.Forms.ImageList imgMain;
		private System.Windows.Forms.ColumnHeader columnHeader1;
		private System.ComponentModel.IContainer components;

		public frmMain()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Windows.Forms.ListViewItem listViewItem1 = new System.Windows.Forms.ListViewItem(new System.Windows.Forms.ListViewItem.ListViewSubItem[] {
																																								new System.Windows.Forms.ListViewItem.ListViewSubItem(null, "Drawing Manager", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))))}, 0);
			System.Windows.Forms.ListViewItem listViewItem2 = new System.Windows.Forms.ListViewItem(new System.Windows.Forms.ListViewItem.ListViewSubItem[] {
																																								new System.Windows.Forms.ListViewItem.ListViewSubItem(null, "Combination Manager", System.Drawing.SystemColors.WindowText, System.Drawing.SystemColors.Window, new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(204))))}, 1);
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(frmMain));
			this.lvwMain = new System.Windows.Forms.ListView();
			this.columnHeader1 = new System.Windows.Forms.ColumnHeader();
			this.imgMain = new System.Windows.Forms.ImageList(this.components);
			this.SuspendLayout();
			// 
			// lvwMain
			// 
			this.lvwMain.AllowColumnReorder = true;
			this.lvwMain.BackColor = System.Drawing.SystemColors.Window;
			this.lvwMain.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
																					  this.columnHeader1});
			this.lvwMain.Dock = System.Windows.Forms.DockStyle.Left;
			this.lvwMain.Items.AddRange(new System.Windows.Forms.ListViewItem[] {
																					listViewItem1,
																					listViewItem2});
			this.lvwMain.LargeImageList = this.imgMain;
			this.lvwMain.MultiSelect = false;
			this.lvwMain.Name = "lvwMain";
			this.lvwMain.Size = new System.Drawing.Size(96, 477);
			this.lvwMain.StateImageList = this.imgMain;
			this.lvwMain.TabIndex = 0;
			this.lvwMain.Click += new System.EventHandler(this.lvwMain_Click);
			// 
			// imgMain
			// 
			this.imgMain.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit;
			this.imgMain.ImageSize = new System.Drawing.Size(48, 48);
			this.imgMain.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgMain.ImageStream")));
			this.imgMain.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// frmMain
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(784, 477);
			this.Controls.AddRange(new System.Windows.Forms.Control[] {
																		  this.lvwMain});
			this.IsMdiContainer = true;
			this.Name = "frmMain";
			this.Text = "Lottery";
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new frmMain());
		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			lvwMain.Visible = !lvwMain.Visible;
		}

		private void lvwMain_Click(object sender, System.EventArgs e)
		{
			if (lvwMain.SelectedItems.Count > 0)
			{
				Form newMDIChild = null;

				switch(lvwMain.SelectedItems[0].Index)
				{
					case 0:
						foreach(Form child in this.MdiChildren)
							if(child is frmDrawingManager)
							{
								newMDIChild = child;
								newMDIChild.Activate();
							}

						if(newMDIChild == null)
						{
							newMDIChild = new frmDrawingManager();
							newMDIChild.MdiParent = this;
							newMDIChild.Show();
						}
					break;
					case 1:
						foreach(Form child in this.MdiChildren)
							if(child is frmCombinationManager)
							{
								newMDIChild = child;
								newMDIChild.Activate();
							}

						if(newMDIChild == null)
						{
							newMDIChild = new frmCombinationManager();
							newMDIChild.MdiParent = this;
							newMDIChild.Show();
						}
					break;
				}
			}
		}
	}
}
